var orderinfo = {};

//获取请求参数 id
function getQueryString(name) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}
var id = getQueryString("id");
//房间号
var code = getQueryString("code");
$.ajax({

    url: "order/getRoomOrder",
    data: {room_id: id},
    async:false,
    success: function (result) {
        layer.open({
            title: '提示信息',
            offset: '150px',
            skin: 'layui-layer-molv'
            , content: "这是"+code+"号房间的详情！"
        });
        orderinfo = JSON.stringify(result) ;

    }

});

var $content = $(".content");
var $text=$(".text");
// var $layui-bg-red=$(".layui-bg-red");
$text.append(code+"号房间详情")
for (var i = 1; i <= 30; i++) {
    var date = new Date();
    date = date.setDate(date.getDate() + i);
    date = new Date(date);
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    var date_text = year + "-" + month + "-" + day;
    var index=orderinfo.indexOf(date_text);
    /*显示房间号*/
    if(index==-1){
            $content.append("<div class='item'>" + date_text + "</div>");
    }else {
        $content.append("<div class='item-red'>" + date_text + "</div>");
    }

}

/*console.log(year, month, day);*/